package com.huluobo.a2202mvvm_im_douyindemo.mvvmBase.net;

import com.huluobo.a2202mvvm_im_douyindemo.adapter.UpdateIconBeanResult;
import com.huluobo.a2202mvvm_im_douyindemo.bean.AddToCartBeanResult;
import com.huluobo.a2202mvvm_im_douyindemo.bean.CartBeanResult;
import com.huluobo.a2202mvvm_im_douyindemo.bean.CommentBeanResult;
import com.huluobo.a2202mvvm_im_douyindemo.bean.FollowBeanResult;
import com.huluobo.a2202mvvm_im_douyindemo.bean.GiftBeanResult;
import com.huluobo.a2202mvvm_im_douyindemo.bean.LikeBeanResult;
import com.huluobo.a2202mvvm_im_douyindemo.bean.LoginBeanResult;
import com.huluobo.a2202mvvm_im_douyindemo.bean.ShopBeanResult;
import com.huluobo.a2202mvvm_im_douyindemo.bean.VideoListBeanResult;

import io.reactivex.Observable;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.Query;

/**
 * Created by LC on 2024/5/6.
 */
public interface ApiService {
    @GET(Const.URL_VIDEO_LIST)
    Observable<VideoListBeanResult> getVideoList(@Query(Const.PARAM_CURRENT_PAGE) int currentPage,
                                                 @Query(Const.PARAM_PAGE_SIZE) int pageSize);

    @POST(Const.URL_LOGIN)
    Observable<LoginBeanResult> login(@Body RequestBody body);

    @POST(Const.URL_LIKE)
    Observable<LikeBeanResult> likeVideo(@Query(Const.PARAM_VIDEO_ID) int videoId);

    @POST(Const.URL_NO_LIKE)
    Observable<LikeBeanResult> noLikeVideo(@Query(Const.PARAM_VIDEO_ID) int videoId);

    @POST(Const.URL_FOLLOW)
    Observable<FollowBeanResult> followAuth(@Body RequestBody body);

    @GET(Const.URL_COMMENT)
    Observable<CommentBeanResult> getComment(@Query(Const.PARAM_VIDEO_ID) int videoId);

    @POST(Const.URL_SEND_COMMENT)
    Observable<CommentBeanResult> sendComment(@Body RequestBody body);

    @POST(Const.URL_NO_FOLLOW)
    Observable<FollowBeanResult> noFollowAuth(@Body RequestBody body);

    @GET(Const.URL_GIFT)
    Observable<GiftBeanResult> getGiftList();

    //上传文件必须要有Part类型,类似键值对,可以传递一个带key的文件到服务器
    @Multipart
    @POST(Const.URL_UPDATE_USER_ICON)
    Observable<UpdateIconBeanResult> updateUserIcon(@Part MultipartBody.Part part);

    @GET(Const.URL_GET_GOODS_LIST)
    Observable<ShopBeanResult> getGoodsList(@Query(Const.PARAM_CATEGORY_ID) int categoryId,
                                            @Query(Const.PARAM_CURRENT_PAGE) int currentPage,
                                            @Query(Const.PARAM_PAGE_SIZE) int pageSize);

    @POST(Const.URL_ADD_TO_CART)
    Observable<AddToCartBeanResult> addToCart(@Body RequestBody body);

    @GET(Const.URL_QUERY_CART)
    Observable<CartBeanResult> queryCartList();
}
